//
//  LMJHomeListCell.m
//  EPA
//
//  Created by lanou3g on 16/4/20.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "LMJHomeListCell.h"
//延展
@interface LMJHomeListCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLable;

@property (weak, nonatomic) IBOutlet UIImageView *titleImgView;
@property (weak, nonatomic) IBOutlet UILabel *contentLable;
@end
@implementation LMJHomeListCell
//给modelde 里的属性赋值
-(void )layoutSubviews {
    self.contentLable.text = self.model.content;
    self.titleLable.text = self.model.title;
    
    //解析cell里的图片
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.model.coverimg]];
    NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        if (data) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.titleImgView.image = [UIImage imageWithData:data];
            });
        }
    }];
    [dataTask resume];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
